home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / bbs / Hydra11s.lha / HBBS / Source / Node / Node_Misc.c < prev    next >
C/C++ Source or Header  |  1996-06-29  |  19KB  |  540 lines

  1.  
  2. #include <stdio.h>
  3. #include <exec/types.h>
  4. #include <libraries/locale.h>
  5. #include <exec/memory.h>
  6. #include <dos/dosextens.h>
  7. #include <intuition/screens.h>
  8. #include <intuition/intuition.h>
  9. #include <intuition/gadgetclass.h>
  10. #include <libraries/gadtools.h>
  11. #include <diskfont/diskfont.h>
  12. #include <utility/utility.h>
  13. #include <graphics/gfxbase.h>
  14. #include <devices/console.h>
  15. #include <workbench/workbench.h>
  16. #include <graphics/scale.h>
  17. #include <clib/locale_protos.h>
  18. #include <clib/exec_protos.h>
  19. #include <clib/wb_protos.h>
  20. #include <clib/intuition_protos.h>
  21. #include <clib/gadtools_protos.h>
  22. #include <clib/graphics_protos.h>
  23. #include <clib/utility_protos.h>
  24. #include <string.h>
  25. #include <clib/diskfont_protos.h>
  26.  
  27. #include <dos/dos.h>
  28. #include <dos/dostags.h>
  29. #include <stdlib.h>
  30. #include <stdio.h>
  31. #include <ctype.h>
  32. #include <libraries/reqtools.h>
  33.  
  34. #include <clib/alib_protos.h>
  35. #include <clib/dos_protos.h>
  36. #include <clib/reqtools_protos.h>
  37.  
  38. #include "NodeGUI.h"
  39.  
  40. extern struct ReqToolsBase *ReqToolsBase;
  41. extern ULONG InfoWinActive;
  42. extern ULONG *rttags;
  43.  
  44. #include "/common/ANSI_Codes.h"
  45. #include "/common/types.h"
  46. #include "/common/errors.h"
  47. #include "/common/defines.h"
  48. #include "/common/structures.h"
  49. #include "/common/strings.h"
  50. #include "/common/files.h"
  51.  
  52. #include "Node_Console_Protos.h"
  53. #include "Node_Serial_Protos.h"
  54. #include "Node_Main_Protos.h"
  55. #include "Node_Misc_Protos.h"
  56. #include "Node_Input_Protos.h"
  57. #include "/library/hbbscommon_protos.h"
  58. #include "/library/hbbscommon_pragmas.h"
  59. #include "nodelibrary/hbbsnode_protos.h"
  60. #include "nodelibrary/hbbsnode_pragmas.h"
  61.  
  62. extern int N_NodeNum;
  63. extern struct BBSGlobalData *BBSGlobal;
  64. extern struct NodeData *N_ND;
  65. extern struct Library *HBBSCommonBase;
  66. extern struct Library *HBBSNodeBase;
  67.  
  68. #include "/common/shared_protos.h"
  69.  
  70. short fposition(char *substr,char *str,ULONG startpos)
  71. {
  72.   // returns an character offset of a substring in a string
  73.   // this version is CASE SENSITIVE
  74.   // returns -1 if substring not found in the string
  75.  
  76.   char *whstr;
  77.   return((short)((whstr=strstr(str+startpos,substr)) ? (short)((LONG)whstr-(LONG)str) : -1));
  78. }
  79.  
  80. void strftcpy(char *dest,char *source,int from,int topos)
  81. {
  82.   int loop=from,pos=0;
  83.   if (from<=strlen(source)-1)
  84.   {
  85.     while (source[loop] && loop<=topos)
  86.     {
  87.       dest[pos]=source[loop];
  88.       loop++;
  89.       pos++;
  90.     }
  91.   }
  92.   dest[pos]=0;
  93. }
  94.  
  95. char *HBBS_AccessName(V_SMALLNUM Access)  // *C* move to HBBSCommon.library
  96. {
  97.   struct Node *node;
  98.   V_BIGNUM loop;
  99.   char tmpstr[10];
  100.   sprintf(tmpstr,"%d",Access);
  101.  
  102.   // check all access levels!
  103.   for (loop=0;loop<BBSGlobal->AcsLevels;loop++)
  104.   {
  105.     // get the level number node.
  106.     if(node=GetNode(BBSGlobal->AcsLevelList,loop))
  107.     {
  108.       // same as the level we want to find ?
  109.       if (stricmp(tmpstr,node->ln_Name)==0)
  110.       {
  111.         // yup, so get the name
  112.         if(node=GetNode(BBSGlobal->AcsLevelNames,loop))
  113.         {
  114.           // and return it!
  115.           return(node->ln_Name);
  116.         }
  117.       }
  118.     }
  119.   }
  120.   return(NULL);
  121. }
  122.  
  123. void PausePrompt(char *promptstr,ULONG Timeout)
  124. {
  125.   char prompt[BIG_STR];
  126.  
  127.   if ((promptstr && promptstr[0]==0) || (!promptstr))
  128.   {
  129.     MenuPrompt("Press [Return] to continue!",' ');
  130.   }
  131.   else
  132.   {
  133.     strcpy(prompt,promptstr);
  134.     HBBS_ModifyString(prompt);
  135.     PutText(prompt);
  136.   }
  137.  
  138.   Get_Line(GL_IMMEDIATE,'\0',1,Timeout,NULL);
  139.   PutText("\n\r");
  140. }
  141.  
  142. V_BOOL ContinuePrompt(char *promptstr,V_BIGNUM Flags)
  143. {
  144.   V_BOOL retval=FALSE;
  145.   char defaultchar='N';
  146.  
  147.   if (promptstr)
  148.   {
  149.     PutText(promptstr);
  150.   }
  151.   else
  152.   {
  153.     PutText(ANSI_RESET "Continue ");
  154.  
  155.   }
  156.   if (Flags & DCP_ADDYN)
  157.   {
  158.     if (Flags & DEFAULT_YES) defaultchar='Y';
  159.     // add to end of string
  160.     MenuPrompt("[Y]es, [N]o : ",defaultchar);
  161.   }
  162.  
  163.   strcpy(N_ND->CharsAllowed,"YyNn");
  164.  
  165.   Get_Line(GL_USECHARS|GL_DISPLAY|GL_EDIT|GL_IMMEDIATE,'\0',1,0,NULL);
  166.  
  167.   if (N_ND->OnlineStatus==OS_ONLINE)
  168.   {
  169.     if (((N_ND->CurrentLine[0]=='\0') && (Flags & DEFAULT_YES)) || (toupper(N_ND->CurrentLine[0])=='Y'))
  170.     {
  171.       retval=TRUE;
  172.     }
  173.     else
  174.     {
  175.       retval=FALSE;
  176.     }
  177.   }
  178.  
  179.   return(retval);
  180. }
  181.  
  182. void DisplayBuffer(UBYTE *LineBuffer, BOOL CheckSequences) // LINEBUFFER MUST BE BIG_STR or larger!!
  183. {
  184.   char *errorstr="<ERROR>";
  185.   UBYTE *tmpstr,checkstr[BIG_STR],mystr[BIG_STR],formatstr[20],outstr[BIG_STR],doorname[BIG_STR],dooroptions[BIG_STR];
  186.   BOOL Done,found;
  187.   short startpos,endpos;
  188.  
  189.  
  190.   tmpstr=mystr;
  191.   if (CheckSequences)
  192.   {
  193.     Done=FALSE;
  194.     strcpy(tmpstr,LineBuffer);
  195.     LineBuffer[0]=0;
  196.  
  197.     while (!Done)
  198.     {
  199.       Done=TRUE;
  200.  
  201.       // is there a sequence introducer in the buffer ?
  202.  
  203.       if ((startpos=position("@^",tmpstr))>=0)
  204.       {
  205.         // yup, but is it followed by a sequence terminator ?
  206.         if ((endpos=fposition("@",tmpstr,startpos+2))>=0)
  207. //        if ((endpos=position("@",tmpstr+startpos+2))>=0)
  208.         {
  209.           // yes it is. so make sure we check for more sequences when we've done this one
  210.           Done=FALSE;
  211.  
  212.           // get the sequence from the buffer.. missing off the introducer
  213.           // and the terminator, i.e. the bit between the @^ and the @
  214.  
  215.           strftcpy(checkstr,tmpstr,startpos+2,endpos-1);
  216.  
  217.           // copy the normal text to the output buffer.
  218.  
  219.           if (startpos) strncat(LineBuffer,tmpstr,startpos);
  220.  
  221.           // modify our temporary buffer..
  222.  
  223. //          strfcpy(tmpstr,tmpstr,endpos+1);
  224.           tmpstr=tmpstr+endpos+1;
  225.  
  226.           if (endpos-1>startpos+2) // skip @^@'s
  227.           {
  228.  
  229.  
  230.             formatstr[0]=0;
  231.             if ((startpos=position("^",checkstr))>=0)
  232.             {
  233.               if (startpos)
  234.               {
  235.                 strftcpy(formatstr,checkstr,0,startpos-1);
  236.               }
  237.               strfcpy(checkstr,checkstr,startpos+1);
  238.             }
  239.  
  240.             StripSpaces(checkstr);
  241.             if ((startpos=position(" ",checkstr))>=0)
  242.             {
  243.               strNcpy(doorname,checkstr,startpos);
  244.               strftcpy(dooroptions,checkstr,startpos+1,strlen(checkstr)-1);
  245.             }
  246.             else
  247.             {
  248.               strcpy(doorname,checkstr);
  249.               dooroptions[0]=0;
  250.             }
  251.  
  252.             if (stricmp(formatstr,"CLS")==0) PutText(ANSI_CLS); else
  253.             if (stricmp(formatstr,"PAUSE")==0) PausePrompt(checkstr,0); else
  254.             if (stricmp(formatstr,"SCREEN")==0) DisplayScreen(checkstr); else
  255.             if (stricmp(formatstr,"SSCREEN")==0) DisplaySpecialScreen(checkstr); else
  256.             if (stricmp(formatstr,"SYSDOOR")==0) GoSystemDoor(doorname,dooroptions); else
  257.             if (stricmp(formatstr,"TPAUSE")==0) PausePrompt(NULL,atol(checkstr)); else
  258.             if (stricmp(formatstr,"USERDOOR")==0) GoUserDoor(doorname,dooroptions); else
  259.             {
  260.  
  261.               // check checkstr against table and store result in same variable.
  262.  
  263.               // this looks shite, but is actually quite fast compared to checking for all occurences!
  264.  
  265.               found=TRUE;
  266.               switch(toupper(checkstr[0]))
  267.               {
  268.                 case 'B':
  269.                   if (stricmp("BBSName",checkstr)==0) strcpy(checkstr,BBSGlobal->BBSName); else
  270.                   if (stricmp("BBSLocation",checkstr)==0) strcpy(checkstr,BBSGlobal->BBSLocation); else
  271.                   if (stricmp("BBSCountry",checkstr)==0) strcpy(checkstr,BBSGlobal->BBSCountry); else
  272.                   if (stricmp("BBSSerial",checkstr)==0) sprintf(checkstr,"%d",BBSGlobal->BBSSerial); else
  273.                   if (stricmp("BBSNodes",checkstr)==0) sprintf(checkstr,"%d",BBSGlobal->BBSNodes); else
  274.                     found=FALSE;
  275.                   break;
  276.                 case 'C':
  277.                   if (stricmp("Conferences",checkstr)==0) sprintf(checkstr,"%d",BBSGlobal->Conferences); else
  278.                     found=FALSE;
  279.                   break;
  280.                 case 'D':
  281.                   if (stricmp("Date",checkstr)==0) HBBS_GetDate(checkstr); else
  282.                     found=FALSE;
  283.                   break;
  284.                 case 'S':
  285.                   if (stricmp("Sysop",checkstr)==0) strcpy(checkstr,BBSGlobal->SysopAccount); else
  286.                     found=FALSE;
  287.                   break;
  288.                 case 'T':
  289.                   if (stricmp("TotalUsers",checkstr)==0) sprintf(checkstr,"%d",BBSGlobal->TotalUsers); else
  290.                   if (stricmp("Time",checkstr)==0) HBBS_GetTime(checkstr); else
  291.                     found=FALSE;
  292.                   break;
  293.                 default:
  294.                   found=FALSE;
  295.               }
  296.  
  297.               if ((!found) && (N_ND->User.Valid))
  298.               {
  299.                 found=TRUE;
  300.                 switch(toupper(checkstr[0]))
  301.                 {
  302.                   case 'A':
  303.                     if (stricmp("AccessName",checkstr)==0) strcpy(checkstr,HBBS_AccessName(N_ND->User.CallData.Access)); else
  304.                     if (stricmp("Access",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.Access); else
  305.                     if (stricmp("A_UploadBytes",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.ActualUploadBytes); else
  306.                     if (stricmp("A_DownloadBytes",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.ActualDownloadBytes); else
  307.                     if (stricmp("A_UploadFiles",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.ActualUploadFiles); else
  308.                     if (stricmp("A_DownloadFiles",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.ActualDownloadFiles); else
  309.                       found=FALSE;
  310.                     break;
  311.                   case 'B':
  312.                     if (stricmp("BestCPSUp",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.BestCPSUp); else
  313.                     if (stricmp("BestCPSDown",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.BestCPSDown); else
  314.                     if (stricmp("BRatio",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.BytesRatio); else
  315.                     if (stricmp("BytesUsed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.BytesUsed); else
  316.                     if (stricmp("BytesAllowed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.BytesAllowed); else
  317.                       found=FALSE;
  318.                     break;
  319.                   case 'C':
  320.                     if (stricmp("ComputerType",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.ComputerType); else
  321.                     if (stricmp("Country",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.Country); else
  322.                     if (stricmp("CallsMade",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.CallsMade); else
  323.                     if (stricmp("ChatAllowed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.ChatAllowed); else
  324.                     if (stricmp("CallsAllowed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.CallsAllowed); else
  325.                     if (stricmp("ChatUsed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.ChatUsed); else
  326.                     if (stricmp("CallsUsed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.CallsUsed); else
  327.                       found=FALSE;
  328.                     break;
  329.                   case 'D':
  330.                     if (stricmp("DownloadBytes",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.DownloadBytes); else
  331.                     if (stricmp("DownloadFiles",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.DownloadFiles); else
  332.                       found=FALSE;
  333.                     break;
  334.                   case 'F':
  335.                     if (stricmp("FRatio",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.FilesRatio); else
  336.                       found=FALSE;
  337.                     break;
  338.                   case 'G':
  339.                     if (stricmp("Group",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.Group); else
  340.                     if (stricmp("GeoLocation",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.GeoLocation); else
  341.                       found=FALSE;
  342.                     break;
  343.                   case 'H':
  344.                     if (stricmp("Handle",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.Handle); else
  345.                       found=FALSE;
  346.                     break;
  347.                   case 'L':
  348.                     if (stricmp("LastConf",checkstr)==0) strcpy(checkstr,HBBS_ListName(BBSGlobal->ConfList,N_ND->User.CallData.LastConf-1)); else
  349.                     if (stricmp("LastConfNum",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.LastConf); else
  350.                     if (stricmp("LinesPerScreen",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.LinesPerScreen); else
  351.                       found=FALSE;
  352.                     break;
  353.                   case 'M':
  354.                     if (stricmp("MessagesWritten",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.MessagesWritten); else
  355.                       found=FALSE;
  356.                     break;
  357.                   case 'P':
  358.                     if (stricmp("PagesMade",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.PagesMade); else
  359.                     if (stricmp("PhoneNumber",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.PhoneNumber); else
  360.                     if (stricmp("Password",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.Password); else
  361.                     if (stricmp("PreferedConfNum",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.PreferedConf); else
  362.                     if (stricmp("PreferedConf",checkstr)==0) strcpy(checkstr,HBBS_ListName(BBSGlobal->ConfList,N_ND->User.CallData.PreferedConf)); else
  363.                       found=FALSE;
  364.                     break;
  365.                   case 'R':
  366.                     if (stricmp("RealName",checkstr)==0) strcpy(checkstr,N_ND->User.CallData.RealName); else
  367.                       found=FALSE;
  368.                     break;
  369.                   case 'S':
  370.                     if (stricmp("Status",checkstr)==0) sprintf(checkstr,"%c",N_ND->User.CallData.Status); else
  371.                       found=FALSE;
  372.                     break;
  373.                   case 'T':
  374.                     if (stricmp("TimeAllowed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.TimeAllowed); else
  375.                     if (stricmp("TimeUsed",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.TimeUsed+HBBS_TimeOnline()); else
  376.                     if (stricmp("TimeLeft",checkstr)==0) sprintf(checkstr,"%d",HBBS_TimeLeft()); else
  377.                     if (stricmp("TimeOnline",checkstr)==0) sprintf(checkstr,"%d",HBBS_TimeOnline()); else
  378.                       found=FALSE;
  379.                     break;
  380.                   case 'U':
  381.                     if (stricmp("UserID",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.UserID); else
  382.                     if (stricmp("UserType",checkstr)==0) sprintf(checkstr,"%c",N_ND->User.CallData.UserType); else
  383.                     if (stricmp("UploadBytes",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.UploadBytes); else
  384.                     if (stricmp("UploadFiles",checkstr)==0) sprintf(checkstr,"%d",N_ND->User.CallData.UploadFiles); else
  385.                       found=FALSE;
  386.                     break;
  387.  
  388. // *** Copy Me! ***
  389. //                  case '':
  390. //                      found=FALSE;
  391. //                    break;
  392.  
  393.                   default:
  394.                     found=FALSE;
  395.                 }
  396.               }
  397.  
  398.               if (!found)
  399.               {
  400.                 strcpy(checkstr,errorstr);
  401.               }
  402.               sprintf(outstr,"%%%ss",formatstr);
  403.               sprintf(LineBuffer+strlen(LineBuffer),outstr,checkstr);
  404.             }
  405.           }
  406.         }
  407.       }
  408.     }
  409.     strcat(LineBuffer,tmpstr);  // and copy what's left..
  410.   }
  411.   PutText(LineBuffer);
  412.   PutText("\r\n");
  413. }
  414.  
  415. V_BOOL DisplayScreen(char *ScreenName)
  416. {
  417.   BPTR FH,FL;
  418.   struct FileInfoBlock FIB;
  419.   UBYTE buffer[BIG_STR];
  420.   BOOL retval=FALSE,checkcodes=FALSE;
  421.  
  422.   PutText(ANSI_RESET);
  423.  
  424.   // if we are online or the activedoor is "Awaiting Connect"  // *C* Document this! vvvvvv
  425.   // AND file exists then continue..
  426.  
  427.   if (((N_ND->OnlineStatus==OS_ONLINE) || ((N_ND->ActiveDoor) && (iposition("AWAITING CONNECT",N_ND->ActiveDoor->node.ln_Name)>=0))) &&
  428.       (AssignOK(ScreenName)) && (FL=Lock(ScreenName,ACCESS_READ)))
  429.   {
  430.     if (Examine(FL,&FIB))
  431.     {
  432.       if (FIB.fib_Size)
  433.       {
  434.         if (FH=OpenFromLock(FL))
  435.         {
  436.           retval=TRUE;
  437.  
  438.           if (FGets(FH,buffer,BIG_STR)) // check the first line for a @^@
  439.           {
  440.             if (strncmp(buffer,"@^@",3)==0) checkcodes=TRUE;
  441.             stripcr(buffer);
  442.             DisplayBuffer(buffer,checkcodes);
  443.           }
  444.  
  445.           while (FGets(FH,buffer,BIG_STR))
  446.           {
  447.             stripcr(buffer);
  448.             DisplayBuffer(buffer,checkcodes);
  449.           }
  450.           Close(FH);
  451.           FL=NULL;
  452.         }
  453.       }
  454.     }
  455.     if (FL) UnLock(FL);
  456.   }
  457.   PutText(ANSI_RESET);
  458.  
  459.   return(retval);
  460. }
  461.  
  462. /*
  463. void MenuPrompt(char *promptstr,char promptdefault)
  464. {
  465.   char tmpstr[1024];
  466.   char matchstr[4];
  467.   char replacestr[1024];
  468.  
  469.   strcpy(tmpstr,promptstr);
  470.  
  471.   if (promptdefault!=' ')
  472.   {
  473.     sprintf(matchstr,"[%c]",promptdefault);
  474.     sprintf(replacestr,"["ANSI_BOLD"%c"ANSI_RESET"]",promptdefault);
  475.  
  476.     replace(tmpstr,tmpstr,matchstr,replacestr);
  477.   }
  478.  
  479.   if (tmpstr[0]=='[')
  480.   {
  481.     strcpy(replacestr,ANSI_FG_BLUE "[" ANSI_FG_YELLOW);
  482.     strcat(replacestr,&tmpstr[1]);
  483.     strcpy(tmpstr,replacestr);
  484.   }
  485.  
  486.   replace(tmpstr,tmpstr," ["," "ANSI_FG_BLUE "[" ANSI_FG_YELLOW);
  487.   replace(tmpstr,tmpstr,"]",ANSI_FG_BLUE "]" ANSI_FG_WHITE);
  488.  
  489.   PutText(ANSI_RESET);
  490.   PutText(tmpstr);
  491. }
  492.  
  493.   V_STRING MenuTextANSI;            // default:     "white"
  494.   V_STRING MenuOpenBracket;         // default: [   "blue + ["
  495.   V_STRING MenuCloseBracket;        // default: ]   "blue + ]"
  496.   V_STRING MenuHighlightANSI;       // default:     "yellow"
  497.   V_STRING MenuDefaultOptANSI;      // default:     "bold + white"
  498.   V_STRING MenuPromptANSI;          // default:  :  " blue + : "
  499.  
  500. */
  501.  
  502. void MenuPrompt(char *promptstr,char promptdefault)
  503. {
  504.   char tmpstr[1024];
  505.   char matchstr[4];
  506.   char replacestr[1024];
  507.  
  508.   strcpy(tmpstr,promptstr);
  509.  
  510.   if (promptdefault!=' ')
  511.   {
  512.     sprintf(matchstr,"[%c]",promptdefault);
  513.     sprintf(replacestr,"%s%s%c%s",N_ND->BBSCols->MenuOpenBracket,N_ND->BBSCols->MenuDefaultOptANSI,promptdefault,N_ND->BBSCols->MenuCloseBracket);
  514.  
  515.     replace(tmpstr,tmpstr,matchstr,replacestr);
  516.   }
  517.  
  518.   if (tmpstr[0]=='[')
  519.   {
  520.     strcpy(replacestr,N_ND->BBSCols->MenuOpenBracket);
  521.     strcat(replacestr,N_ND->BBSCols->MenuHighlightANSI);
  522.     strcat(replacestr,&tmpstr[1]);
  523.     strcpy(tmpstr,replacestr);
  524.   }
  525.  
  526.   replacestr[0]=' ';
  527.   replacestr[1]=0;
  528.   strcat(replacestr,N_ND->BBSCols->MenuOpenBracket);
  529.   strcat(replacestr,N_ND->BBSCols->MenuHighlightANSI);
  530.   replace(tmpstr,tmpstr," [",replacestr);
  531.  
  532.   strcpy(replacestr,N_ND->BBSCols->MenuCloseBracket);
  533.   strcat(replacestr,N_ND->BBSCols->MenuTextANSI);
  534.   replace(tmpstr,tmpstr,"]",replacestr);
  535.  
  536.   PutText(ANSI_RESET);
  537.   PutText(tmpstr);
  538. //  PutText(N_ND->BBSCols->MenuPromptANSI);
  539. }
  540.